<?php
/*
 * 用户中心
 */
namespace Mobile\Controller;

use Mobile\Model\moneylogModel;

class MoneylistsController extends BaseController {
    
    public $moneylogModel;
    
    public function __construct() {
        parent::__construct();
        $this->moneylogModel = new moneylogModel();
    }
    
  /*
     * 我的佣金流水
     */
    public function money(){
        $seo_data = array(
            "title" => "我的".C('YONGJIN_NAME'),
            "description" => "",
            "keywords" => "",
        );
        $this->setSeo($seo_data);

        
        $page_size = C("MOBILE_PAGESIZE");//分页条数
        $page = get('p',1);
        $where = array(
            'uid' => $this->uid,
            "mtype" =>array('in',array(1,12)),
            'un_Lock' => 1
        );
        $datalist = $this->moneylogModel->getMoneylogList($where, $page,$page_size);
        
        $a_count = $this->moneylogModel->where($where)->count();//总的记录数量
        $totalpage = ceil($a_count/$page_size);//向上取整,总的页码数
        $this->assign('totalpage',$totalpage);
        
        if(IS_AJAX){
            exit_json($datalist);
        }
        
        
    
        $this->assign('datalist',$datalist);
        
        $share_data = array(
            "title" => "我的".C('YONGJIN_NAME'),
        );
        $this->setShare($share_data);
        
        $this->display();
    }
    
    public function prizemoney(){
        $seo_data = array(
            "title" => "我的".C('YONGJIN_NAME'),
            "description" => "",
            "keywords" => "",
        );
        $this->setSeo($seo_data);

        
        $page_size = C("MOBILE_PAGESIZE");//分页条数
        $page = get('p',1);
        $where = array(
            'uid' => $this->uid,
            "mtype" =>array('in',array(12)),
            'un_Lock' => 1
        );
        $datalist = $this->moneylogModel->getMoneylogList($where, $page,$page_size);
        
        $a_count = $this->moneylogModel->where($where)->count();//总的记录数量
        $totalpage = ceil($a_count/$page_size);//向上取整,总的页码数
        $this->assign('totalpage',$totalpage);
        
        if(IS_AJAX){
            exit_json($datalist);
        }
        
        
    
        $this->assign('datalist',$datalist);
        
        $share_data = array(
            "title" => "我的".C('YONGJIN_NAME'),
        );
        $this->setShare($share_data);
        
        $this->display();
    }
    
    /*
     * 我的锁定佣金流水
     */
    public function lockedmoney(){
        $seo_data = array(
            "title" => "我的".C('LOCAKED_MONEY'),
            "description" => "",
            "keywords" => "",
        );
        $this->setSeo($seo_data);
    
    
        $page_size = C("MOBILE_PAGESIZE");//分页条数
        $page = get('p',1);
        $where = array(
            'uid' => $this->uid,
            "mtype" =>1,
            'un_lock' => 0,
        );
        $datalist = $this->moneylogModel->getMoneylogList($where, $page,$page_size);
    
        $a_count = $this->moneylogModel->where($where)->count();//总的记录数量
        $totalpage = ceil($a_count/$page_size);//向上取整,总的页码数
        $this->assign('totalpage',$totalpage);
        
        
    
        if(IS_AJAX){
            exit_json($datalist);
        }
    
    
    
        $this->assign('datalist',$datalist);
    
        $share_data = array(
            "title" => "我的".C('LOCAKED_MONEY'),
        );
        $this->setShare($share_data);
    
        $this->display();
    }
    

    

    /*
     * 我的现金流水
     */
    public function cash(){
        $seo_data = array(
            "title" => "我的".C('CASH_NAME'),
            "description" => "",
            "keywords" => "",
        );
        $this->setSeo($seo_data);

        $page_size = C("MOBILE_PAGESIZE");//分页条数
        $page = get('p',1);
        $where = array(
            'uid' => $this->uid,
            "mtype" =>3
        );
        $datalist = $this->moneylogModel->getMoneylogList($where, $page,$page_size);
        
        $a_count = $this->moneylogModel->where($where)->count();//总的记录数量
        $totalpage = ceil($a_count/$page_size);//向上取整,总的页码数
        $this->assign('totalpage',$totalpage);
        
        if(IS_AJAX){
            exit_json($datalist);
           
        }
    
        $this->assign('datalist',$datalist);
    
        $share_data = array(
            "title" => "我的".C('CASH_NAME'),
        );
        $this->setShare($share_data);
    
        $this->display();
    }
    
    public function score(){
        $seo_data = array(
            "title" => "我的".C('SCORE_NAME'),
            "description" => "",
            "keywords" => "",
        );
        $this->setSeo($seo_data);

        $page_size = C("MOBILE_PAGESIZE");//分页条数
        $page = get('p',1);
        $where = array(
            'uid' => $this->uid,
            "mtype" =>2
        );
        $datalist = $this->moneylogModel->getMoneylogList($where, $page,$page_size);
        
        $a_count = $this->moneylogModel->where($where)->count();//总的记录数量
        $totalpage = ceil($a_count/$page_size);//向上取整,总的页码数
        $this->assign('totalpage',$totalpage);
        
        if(IS_AJAX){
            exit_json($datalist);
           
        }
    
        $this->assign('datalist',$datalist);
    
        $share_data = array(
            "title" => "我的".C('SCORE_NAME'),
        );
        $this->setShare($share_data);
    
        $this->display();
    }
    
    public function stock(){
        $seo_data = array(
            "title" => "我的库存",
            "description" => "",
            "keywords" => "",
        );
        $this->setSeo($seo_data);
        $page_size = C("MOBILE_PAGESIZE");//分页条数
        $page = get('p',1);
        $where = array(
            'uid' => $this->uid,
            "mtype" =>4
        );
        $datalist = $this->moneylogModel->getMoneylogList($where, $page,$page_size);
        $a_count = $this->moneylogModel->where($where)->count();//总的记录数量
        $totalpage = ceil($a_count/$page_size);//向上取整,总的页码数
        $this->assign('totalpage',$totalpage);
        if(IS_AJAX){
            exit_json($datalist);
        }
        $this->assign('datalist',$datalist);
        $share_data = array(
            "title" => "我的库存",
        );
        $this->setShare($share_data);
        $this->display();
    }
    
     public function ex_cash(){
        $seo_data = array(
            "title" => "我的赠送".C('CASH_NAME'),
            "description" => "",
            "keywords" => "",
        );
        $this->setSeo($seo_data);

        $page_size = C("MOBILE_PAGESIZE");//分页条数
        $page = get('p',1);
        $where = array(
            'uid' => $this->uid,
            "mtype" =>4
        );
        $datalist = $this->moneylogModel->getMoneylogList($where, $page,$page_size);
        
        $a_count = $this->moneylogModel->where($where)->count();//总的记录数量
        $totalpage = ceil($a_count/$page_size);//向上取整,总的页码数
        $this->assign('totalpage',$totalpage);
        
        if(IS_AJAX){
            exit_json($datalist);
        }
    
        $this->assign('datalist',$datalist);
    
        $share_data = array(
            "title" => "我的赠送".C('CASH_NAME'),
        );
        $this->setShare($share_data);
    
        $this->display();
    }
    
    
    
}